package com.geostar.gmp.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.geostar.gmp.model.Pc_data;
import com.geostar.gmp.utils.CreateID;
import com.geostar.gmp.utils.JsonUtils;
import com.opensymphony.xwork2.ActionSupport;

public class TestHighchartsAction extends ActionSupport{

	private static final long serialVersionUID = 5118592064220899981L;
	
	private String result;
	/**
	 * 目的: 返回highchart测试数据
	 * @return
	 * @throws Exception
	 *
	 */
	public String getHV() throws Exception {
		
		List<Pc_data> pc_dataList = new ArrayList<Pc_data>();
		Pc_data pc_data =null;
		for (int i = 0; i < 12; i++) {
			pc_data = new Pc_data();
			pc_data.setId(CreateID.generate9());
			int a = new Random().nextInt(10);
			pc_data.setCpu(String.valueOf(a));
			pc_dataList.add(pc_data);
		}
		
		this.result = JsonUtils.bean2Json(pc_dataList);
		return SUCCESS;
	}
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
}
